<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
			.createlab{
				font-size: 13px;
				margin-top: 11px;
				color: #c5c5c5;
			}
			
			.exitfollow{
				font-size: 13px;
				background-color: #f2f2f2;
				padding: 4px;
				margin-bottom: 20px;
			}
			
			.returnloge{
				width: 50px;
				height: 50px;
			}
		</style>
	</head>
	<body>
		<div class="house-part" id="house-list">
				<!--<div class="content-area" >-->
					<div class="house" v-for="item in houses" style="width: 920px;">
						<!--<div class="horizon"></div>-->
						<div class="topoffset items-display-flex flex-row flex-between">
							<div class="items-display-flex flex-row" style="flex-direction: row;align-items:flex-start;">
								<div class="image" style="height: 210px;" v-on:click="gotoDetail(item.id)">
									<img v-bind:src="item.img_path" style="width: 220px;height: 180px;border-radius: 5px;"/>
									<!--<span>与{{item.create_time}}关注</span>-->
									<div class="createlab" >于{{item.create_time}}关注</div>
								</div>
								
								
								<div class="intro" >
									<div class="lab1" v-on:click="gotoDetail(item.id)">{{item.house_name}}</div>
									<div class="lab2">
										<span class="location iconfont icon-weizhi"></span>
										<span>[{{item.region_name}}]</span>
										<span class="offset">地址：{{item.address}}</span>
									</div>
									<div class="lab2">
										单价：<span>{{item.house_unit_price}}元/m<sup>2</sup></span> <span class="line"></span> 
									</div>
									<div class="lab2">
										总价：
										<span class="price">{{item.total_price}}</span><span class="price-note">万起</span>
									</div>
								</div>
							</div>
							
							<div class="logo-part" >
								<div class="exitfollow" v-on:click="exitfollow(item)">取消关注</div>
								<img class="returnloge" src="../img/logo.png" />
								<div class="lab1" style="font-size: 13px;color: #000000;">口袋返现</div>
								<div class="lab2" style="font-size: 13px;">{{item.return_money}}万/套</div>
							</div>
						</div>
						<div class="horizon" style="margin-top:20px;"></div>
					</div>
					
					<!--<div class="nav-page items-display-flex flex-row" v-if="total_page > 0">
						<div v-for='(items,index) in page_nav' class="items-display-flex flex-row">
							<div class="nav items-display-flex flex-row" v-for="item in items">
								<div v-on:click="pageleft" v-if="item == 'left'" class="flag unactive-nav-page iconfont icon-nvxingfuben"></div>
								<div v-on:click="pageright" v-else-if="item == 'right'" class="flag unactive-nav-page iconfont icon-nvxingfuben1"></div>
								<div v-on:click="pageto(item)" v-else v-bind:class="[item==cur_pageindex ? 'active-nav-page':'unactive-nav-page']">{{item}}</div>
							</div>
							<div v-if="index < page_nav.length-1">...</div>
						</div>
					</div>-->
				<!--</div>-->
			</div>
	</body>
	
	<script>
		

		var curUserid = 0;
		var maincnt = new Vue({
			el:'#house-list',
			data:{
				menuindex:0,
				houses:{},
				isloadtops:false
			},
			methods:{
				changeMenu:function(index){
					this.menuindex = index;
					if(this.menuindex == 1){
						console.log('this 1='+this.menuindex);
						$('#follow').load('../user/user_follow.html');
					}
				},
				exitfollow:function (objs){
					showtips(objs,{tipsmsg:'是否真的要取消此关注',tipstype:1});
				},
				gotoDetail:function(houseid){
					var urlstr = '../pages/xfdetail.html?hid=' + houseid;
					window.open(urlstr);
				}
			}
		});
		
		function showtips(objs,tipsobj){
			if(!maincnt.isloadtops){
				$('#tips_sets').load('../template/tips.html',function(){
					InitTip(tipsobj,objs);
					maincnt.isloadtops = true;
					showtipsPanel();
				});
			}
			else{
				showtipsPanel();
				InitTip(tipsobj,objs);
			}
		}
		
		function loadNewHouse() {			
			var urlstr = publicUrl + '/v1/favorite/list';
			
			jQuery.get(urlstr, {
				uid: curUserid
			}, function(res) {

				var arr = res.data.list;				
				for(var i = 0; i < arr.length; i++) {
					arr[i].img_path = LocalImgUrl + arr[i].img_path;
					arr[i].region_name = getRegionName(arr[i].region_id);
				}
				maincnt.houses = arr;
			});
		}
		
		//取消方法
		function tipsokfun(objs){
			var urlstr = publicUrl + '/v1/favorite/edit';
			jQuery.get(urlstr, {uid:curUserid,house_id:objs.id,status:0}, 
				function(res) {
					if(res.code=="success"){
		                 showtips({},{tipsmsg:'取消关注成功',tipstype:2});
		                 loadNewHouse();
		            }
		            else {
						 showtips({},{tipsmsg:res.message,tipstype:2});
		            }
			});	
		}
		
		function tipsexitfun(objs){
			closePanl();
		}
		
		setTimeout(function(){
			var cuinfo = getUserInfo();
			if(cuinfo){
				curUserid = cuinfo.uid;
				loadNewHouse();
			}
		},200);
		
	</script>
</html>
